package com.zatech.cgnci.project.base.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;


/**
 * @author user
 */

@Getter
@AllArgsConstructor
public enum BusinessStatusEnum {

    ENTERING("0", "录入中"),

    UNDER_REVIEW("1", "审核中"),

    RETURN_ENTERING("2", "退回录入中"),

    COMPLETED("3", "已完成"),

    SIGN_OUT("4", "已注销"),

    CANCEL_APPLYING("5", "作废申请中"),

    CANCEL_UNDER_REVIEW("6", "作废审核中"),

    CANCELLED("7", "已作废"),
    ;

    public static BusinessStatusEnum getEnumByCode(String code) {
        return Arrays.stream(values()).filter(e -> Objects.equals(e.getCode(), code)).findAny().orElse(null);
    }
    
    public static String getDescByCode(String code){
        BusinessStatusEnum businessStatusEnum = Arrays.stream(values()).filter(e -> Objects.equals(e.getCode(), code)).findAny().orElse(null);
        return businessStatusEnum==null?"":businessStatusEnum.getDesc();
    }

    private final String code;
    private final String desc;
}
